package com.jiyun.controller;
import com.jiyun.pojo.RiderQueue;
import com.jiyun.service.IRiderQueueMService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.jiyun.pojo.Result;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-25
 */
@RestController
@CrossOrigin
@RequestMapping("/queue")
public class RiderQueueMController {
    @Autowired
    private IRiderQueueMService RiderQueueService;

    /*
    findAll()方法:
    师小雨测试用的 与项目无关
    RiderQueue表想要查询列表只能写sql语句 不能用mybatis自带的方法
     */
    @RequestMapping("findAll")
    public List<RiderQueue> findAll() {
        return RiderQueueService.findAll();
    }
    @GetMapping("/find")
    public List<RiderQueue> find(@RequestParam("status") Integer status,
                             @RequestParam("did") Integer did) {
//        System.out.println("status = " + RiderQueuetatus);
        List<RiderQueue> list = RiderQueueService.getStatusFind(status,did);
        return list;
    }
    @PostMapping("/update")
    public Result update(@RequestParam("id") Integer id,@RequestParam("drivervaluation") String drivervaluation){
        RiderQueueService.updateOrder(id,drivervaluation);
        return Result.success("成功");
    }
    @GetMapping("findOne")
    public RiderQueue findOne(@RequestParam("orderId") String orderId){
        RiderQueue byId = RiderQueueService.findOne(orderId);
        return byId;
    }
    @GetMapping("/findPhone")
    public List<RiderQueue> findPhone(@RequestParam("did") Integer did){
        List<RiderQueue> list = RiderQueueService.findPhone(did);
        return list;
    }

    @GetMapping("/getOne")
    public RiderQueue getOne(@RequestParam("id") Integer id,
                             @RequestParam("did") Integer did){
        RiderQueue byId = RiderQueueService.findEndOne(id,did);
        return byId;
    }
}
